package com.kygeng.common.model.document;

import com.kygeng.common.config.ElasticCompanyIndexConfig;
import com.kygeng.common.model.License;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;

import java.util.List;

/**
 * @Title: CompanyInfo
 * @Author: kygeng
 * @Package: com.kygeng.dataupdate.model
 * @Date: 2024/8/31 10:55
 * @Description:
 */
@Data
@Document(indexName = ElasticCompanyIndexConfig.COMPANY_INDEX_NAME)
public class CompanyInfoDoc {

    @Id
    private Integer id;

    @Field(type = FieldType.Keyword)
    private String companyCode;//公司编号

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String companyName;//公司名称

    @Field(type = FieldType.Keyword)
    private String socialCreditCode;//统一社会信用代码

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String legalRepresentative;//法人

    @Field(type = FieldType.Double)
    private Double capitalRegistered;//注册资本

    @Field(type = FieldType.Keyword)
    private String capitalRegisteredCurrency;//注册资本单位

    @Field(type = FieldType.Double)
    private Double capitalPaid;//实缴资本

    @Field(type = FieldType.Keyword)
    private String capitalPaidCurrency;//实缴资本单位

    @Field(type = FieldType.Keyword)
    private String companyScale;//企业规模

    @Field(type = FieldType.Keyword)
    private String companyStatus;//企业状态

    @Field(type = FieldType.Keyword)
    private String companyType;//企业类型

    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyyMMdd")
    private String establishmentData;//成立日期

    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyyMMdd")
    private String businessDateStart;//经营期限起

    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyyMMdd")
    private String businessDateEnd;//经营期限止

    @Field(type = FieldType.Text, analyzer = "ik_smart", searchAnalyzer = "ik_smart")
    private String addressRegister;//注册地址

    @Field(type = FieldType.Text, analyzer = "ik_smart", searchAnalyzer = "ik_smart")
    private String addressOffice;//办公地址

    @Field(type = FieldType.Keyword)
    private String areaCode;//地区代码

    @Field(type = FieldType.Keyword)
    private String province;//所在省

    @Field(type = FieldType.Keyword)
    private String city;//所在市

    @Field(type = FieldType.Keyword)
    private String region;//所在区

    @Field
    private GeoPoint location;//坐标系的地址位置

    @Field(type = FieldType.Keyword)
    private String industryCode;//行业编码

    @Field(type = FieldType.Keyword)
    private String industryName;//行业名称

    @Field(type = FieldType.Auto)
    private List<String> tags;//公司标签

    @Field(type = FieldType.Nested) //嵌套类型
    private List<License> licenses;//许可信息

    @Field(type = FieldType.Auto)
    private List<String> risk;//风险信息
}
